package com.qf.filter;

import com.github.pagehelper.PageInfo;
import com.qf.entity.TUser;
import com.qf.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;

import javax.servlet.*;
import java.io.IOException;

public class Afilter implements Filter {

    @Autowired
    private IUserService userService;

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        System.out.println("Afilter start");

        PageInfo<TUser> tUserPageInfo = userService.selectPage("1", "2");
        System.out.println(tUserPageInfo);

        filterChain.doFilter(servletRequest,servletResponse);
        System.out.println("Afilter finished");
    }

    @Override
    public void init(FilterConfig filterConfig) throws ServletException {

    }

    @Override
    public void destroy() {

    }
}
